package conf

import (
	"fmt"

	"github.com/BurntSushi/toml"
	"github.com/caarlos0/env/v6"
)

// 如果配置映射成Config对象

// 从Toml格式的配置文件加载配置
func LoadConfigFromToml(FilePath string) error {
	config = NewDefaultConf()
	_, err := toml.DecodeFile(FilePath, config)
	if err != nil {
		return fmt.Errorf("LoadConfigFromToml filepath %s is error, error is %s", FilePath, err)
	}
	return nil
}

// 从环境变量加载配置
func LoadConfigFromEnv() error {

	config = NewDefaultConf()
	return env.Parse(config)

}

func LoadUrlFromToml() {

}
